package dao

import (
	"context"
	"core/models/db"
	"core/repo"
)

type ClubDao struct {
	repo *repo.Manager
}

func (d ClubDao) FindClubById(ctx context.Context, id uint) *db.Club {
	club := new(db.Club)
	d.repo.DB.Client.WithContext(ctx).Table(club.TableName()).Where("id=? AND status=1", id).First(club)
	return club
}

func NewClubDao(m *repo.Manager) *ClubDao {
	return &ClubDao{
		repo: m,
	}
}
